package day2;

import java.util.Arrays;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int num = in.nextInt();

            for(int i = 0; i < num; i++) {
                int n = in.nextInt();
                int k = in.nextInt();
//                int[] arr1 = new int[n];
//                int[] arr2 = new int[n];
                int[] arr = new int[2*n];

                for(int j = 0; j < 2*n; j++) {
                    arr[j] = in.nextInt();
                }

//                int[] splitArray = Arrays.copyOfRange(originalArray, start, end);
//                arr1 = Arrays.copyOfRange(arr, 0, n);
//                arr2 = Arrays.copyOfRange(arr, n, 2*n);
                while(k != 0) {
                    transform(arr);
                    k--;
                }

                for(int j = 0; j < arr.length; j++) {
                    System.out.print(arr[j] + " ");
                }
                System.out.println();
            }
        }
    }

    public static int[] transform(int[] arr) {
        int len = arr.length;
        int[] arr1 = Arrays.copyOfRange(arr, 0, len/2);
        int[] arr2 = Arrays.copyOfRange(arr, len/2, len);

        for(int i = len-1; i >= 0; i--) {
            if(i % 2 == 0) {
                arr[i] = arr1[i/2];
            }else{
                arr[i] = arr2[i/2];
            }
        }

        return arr;
    }
}
